
//
// Wall is the class used to instantiate the indestructible walls
// in the game. no participant can fly or walk over this unit.
//

var Wall = new Class({
	Extends: DynaObject,
	initialize: function(){
		this.parent(GAMEUNITTYPE.WALL);
		game.walls.push(this);
	},
        erase: function(){
            util.removeElementFromArray(this,game.walls);
        },
        terminate: function(){
        this.erase();
        this.parent();
        }
});

//
// Wall is the class used to instantiate the destructible walls
// in the game. a participant can fly or walk over this unit if he has passoverfakewalls goody
//

var FakeWall = new Class({
      Extends: DynaObject,
      initialize: function(){
              this.parent(GAMEUNITTYPE.FAKEWALL);
              game.fakeWalls.push(this);
              this.goody = null;
              var goodyProbability=Math.round(Math.random()*30);
              if(goodyProbability > 18){
           		this.goody = new Goody(); // +life , speed , passoverfakewalls , explosionLength/power
              }
      },
    vaporate: function(){
        util.removeElementFromArray(this,game.fakeWalls);
    },
    terminate: function(){
        this.vaporate();
        this.parent();
        this.leaveGoodyBehind();
    },
    leaveGoodyBehind: function(){
    	if(this.goody!=null){
    		this.goody.appear(this.myZone);
    	}
    }
});